package com.example.design.shejimoshi.action.postprocessor;


import java.util.ArrayList;
import java.util.List;

/**
 * @Description TODO
 * @date 2023/3/21 15:51
 * @Author liuzhihui
 * @Version 1.0
 */
public class PostProcessorTest {
    public static void main(String[] args) {
        List<AlarmPostProcessor> alarmPostProcessors = new ArrayList<>();

        AlarmBO alarmBO = new AlarmBO();


        applyAlarmPostProcessorsBeforeInitialization(alarmBO, alarmPostProcessors);

        initAlarmRecord(alarmBO);

        applyAlarmPostProcessorsAfterInitialization(alarmBO, alarmPostProcessors);
    }

    private static void initAlarmRecord(AlarmBO alarmBO) {
        System.out.println("insert alarm...");
    }

    private static void applyAlarmPostProcessorsAfterInitialization(AlarmBO alarmDO, List<AlarmPostProcessor> alarmPostProcessors) {
        for (AlarmPostProcessor alarmPostProcessor : alarmPostProcessors) {
            alarmPostProcessor.postProcessAfterInitialization(alarmDO);
        }
    }

    private static void applyAlarmPostProcessorsBeforeInitialization(AlarmBO alarmBO, List<AlarmPostProcessor> alarmPostProcessors) {
        for (AlarmPostProcessor alarmPostProcessor : alarmPostProcessors) {
            alarmPostProcessor.postProcessBeforeInitialization(alarmBO);
        }
    }
}
